<!--
 @description 异常验收详情
 @fileName Detail.vue
 @author zengqiongying
 @created 2023/06/18 14:52:38
-->
<template>
  <div style="padding-top: 8px">
    <div class="pd-lr-main">
      <Cell title="申请序号" :modelValue="detail.abnormalNo" readonly />
      <FileItem v-for="(item, i) in list" :key="`${i}-${item.afid}`" v-model="list[i]" readonly />
    </div>
  </div>
</template>

<script lang="ts">
  import { reactive, toRefs } from 'vue'
  import { useRoute } from 'vue-router'
  import { IAnyKeyObject } from '@/types/common'
  import { queryAbnormaDetail } from '@/apis/Abnormal'
  import Cell from '@/components/Cell/index.vue'
  import FileItem from '@/views/components/Abnormal/FileItem.vue'
  export default {
    name: 'AbnormalDetail',
    components: { Cell, FileItem },
    setup() {
      const $route = useRoute()
      const datas = reactive<IAnyKeyObject>({
        said: $route.query?.said || '', // 异常ID
        detail: {
          acceptID: '',
          said: '',
          abnormalNo: ''
        },
        list: [{ sortNumber: 1, sysFileUrl: '', afid: '' }]
      })
      const getDetailData = () => {
        queryAbnormaDetail(datas.said).then((res) => {
          datas.detail = res.data || {}
          datas.list = res.data.abnormalFiles || []
        })
      }
      getDetailData()
      return {
        ...toRefs(datas)
      }
    }
  }
</script>
<style lang="less" scoped></style>
